package com.fqgj.sentry.policy.enums;

import java.util.Objects;

/**
 * Created by ykpbean kangping.ying@yuntu-inc.com
 *
 * @description
 * @create 2017-07-29 上午9:48
 */
public enum ExecutorDefaultResultEnum {

    review(1, "Review", "人工审核"),
    pass(2, "Pass", "系统通过"),
    reject(3, "Reject", "系统拒绝");

    private Integer level;
    private String result;
    private String desc;

    ExecutorDefaultResultEnum(Integer level, String result, String desc) {
        this.level = level;
        this.result = result;
        this.desc = desc;
    }

    public Integer getLevel() {
        return level;
    }

    public ExecutorDefaultResultEnum setLevel(Integer level) {
        this.level = level;
        return this;
    }

    public String getResult() {
        return result;
    }

    public ExecutorDefaultResultEnum setResult(String result) {
        this.result = result;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public ExecutorDefaultResultEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    /**
     * getByResult
     *
     * @param result
     * @return
     */
    public static ExecutorDefaultResultEnum getByResult(String result) {
        for (ExecutorDefaultResultEnum resultEnum : ExecutorDefaultResultEnum.values()) {
            if (Objects.equals(resultEnum.getResult(), result)) {
                return resultEnum;
            }
        }
        return null;
    }
}
